cd "[directory name]"
use "data_jcr.dta", clear

xtset country_id year
set matsize 5000
set more off

set scheme plotplain

*******Benchmark [Table 1] ****************************
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F.alldir camp duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


*predicted probabilities [Figure 3]*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(camp=(0 1)) atmeans saving(margins_1, replace)

logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
margins, at(camp=(0 1)) atmeans saving(margins_2, replace)

combomarginsplot margins_1 margins_2, ///  
	labels("Model 1.1" "Model 1.6") file1opts(msymbol(triangle)) ///
	plotopts(lwidth(thin) lcolor(%30) connect(none)) ///
	xsize(4.5) ysize(3) ///
	offset


*lag/lead plot of coef from benchmark FE [Figure 4]*
logit F5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store mmn5
logit F4.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store mn4
logit F3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store mn3
logit F2.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)  
estimates store mn2
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store mn1
logit alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store m0
logit L.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 i.country_id i.year, vce(cluster country_id) 
estimates store m1
*not converged with cubed duration, but converged with squared
logit L2.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store m2
logit L3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store m3
logit L4.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store m4
logit L5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimates store m5

coefplot mmn5 mn4 mn3 mn2 mn1 m0 m1 m2 m3 m4 m5, keep(camp) yline(0) legend(off) vertical swapnames ///
	coeflabels(F5.alldir = "t-5" F4.alldir = "t-4" F3.alldir = "t-3" F2.alldir = "t-2" F.alldir = "t-1" alldir = "t" L.alldir = "t+1" L2.alldir = "t+2" L3.alldir = "t+3" L4.alldir = "t+4" L5.alldir = "t+5")

*t+1 not converged, stopped after 50 iterations	

*******Different transitions, all campaigns [Table 2]***********

logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimate store a1
logit F.dirdem camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store a2
logit F.dirdem camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimate store a3
logit F.dircoup camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store a4
logit F.dircoup camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimate store a5

estout a1 a2 a3 a4 a5, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year* duration duration2 duration3) 
	 

*******Disagg analysis [Table 3]*********************************

logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store n1
logit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store n2
logit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store n3
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store v1
logit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store v2
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store v3

estout n1 v1 n2 v2 n3 v3, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


*Predicted probabilities nonviolent versus violent [Figure 5]*
logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(nonviol=(0 1)) atmeans saving(file11, replace)
logit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(nonviol=(0 1)) atmeans saving(file22, replace)
logit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(nonviol=(0 1)) atmeans saving(file33, replace)

combomarginsplot file11 file22 file33, legend(off) ///
    labels("All transitions" "Democratization" "Non-democratizing") file1opts(msymbol(triangle) lpattern("_")) file3opts(msymbol(square) lpattern(".-")) fileci1opts(lpattern("_")) fileci3opts(lpattern(".-")) ///
	plotopts(lwidth(thin) lcolor(%30) connect(none)) ///
	fxsize(55) ///
	offset
	
graph save nv, replace
	
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(viol=(0 1)) atmeans saving(file1, replace)
logit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(viol=(0 1)) atmeans saving(file2, replace)
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
margins, at(viol=(0 1)) atmeans saving(file3, replace)

combomarginsplot file1 file2 file3, ///
    labels("All transitions" "Democratizing" "Non-democratizing") file1opts(msymbol(triangle) lpattern("_")) file3opts(msymbol(square) lpattern(".-")) fileci1opts(lpattern("_")) fileci3opts(lpattern(".-")) ///
	plotopts(lwidth(thin) lcolor(%30) connect(none)) ///
	fxsize(90) ///
	offset
	
graph save v, replace
	
graph combine "nv" "v", iscale(1)
	

***APPENDIX**************************************************

*****Tab A.8*
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store full
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store fulls

estout full fulls, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N r2)style (tex) drop (*year* duration duration2 duration3) 

*****Tab A.9*
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id) 
estimate store a1
xi: regress F.dirdem camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store a2
xi: regress F.dirdem camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimate store a3
xi: regress F.dircoup camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store a4
xi: regress F.dircoup camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimate store a5

estout a1 a2 a3 a4 a5, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*year* duration duration2 duration3) 
	 

******Tab A.10*
xi: regress F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store n1
xi: regress F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store n2
xi: regress F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store n3
xi: regress F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store v1
xi: regress F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store v2
xi: regress F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimate store v3

estout n1 v1 n2 v2 n3 v3, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N r2)style (tex) drop (*year*) 

*****Tab A.11*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.region2 i.year, vce(cluster country_id)
estimates store m1
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.region2 if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.region2 i.year, vce(cluster country_id)
estimates store m3
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.region2 i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F.alldir camp duration duration2 duration3 i.region2 i.year, vce(cluster country_id)
estimates store m5
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.region2 i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


***** TabA.12*
xtlogit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 i.year, fe
estimate store a4
xtlogit F.dirdem camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.year, fe
estimate store a5
xtlogit F.dircoup camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.year, fe
estimate store a6

estout a4 a5 a6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll)style (tex) drop (*year* duration duration2 duration3) 

*****Tab A.13*
xtlogit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 i.year, fe
estimate store a4
xtlogit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.year, fe
estimate store a5
xtlogit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.year, fe
estimate store a6
xtlogit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 i.year, fe
estimate store a7
xtlogit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.year, fe
estimate store a8
xtlogit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.year, fe
estimate store a9

estout a4 a7 a5 a8 a6 a8, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll)style (tex) drop (*year* duration duration2 duration3) 



***** Tab A.14*
logit F.alldir wsecess v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F.alldir wsecess v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F.alldir wsecess v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress F.alldir wsecess v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F.alldir wsecess duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F.alldir wsecess v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


***** Tab A.15*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if regother == 0, vce(cluster country_id)
estimates store m1
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1 & regother == 0, vce(cluster country_id)
estimates store m2
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if regother == 0, vce(cluster country_id)
estimates store m3
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1 & regother == 0, vce(cluster country_id)
estimates store m4
logit F.alldir camp duration duration2 duration3 i.country_id i.year if regother == 0, vce(cluster country_id)
estimates store m5
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1 & regother == 0, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


***** Tab A.16*
logit F.allc camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F.allc camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F.allc camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress F.allc camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F.allc camp duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F.allc camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (duration duration2 duration3 *country_id* *year*) 


***** Tab A.17*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimates store m1
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1 & lexical_index != 6, vce(cluster country_id)
estimates store m2
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimates store m3
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1 & lexical_index != 6, vce(cluster country_id)
estimates store m4
logit F.alldir camp duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimates store m5
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1 & lexical_index != 6, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


***** Tab A.18*
logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimate store n1
logit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimate store n2
logit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimate store n3
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimate store v1
logit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimate store v2
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if lexical_index != 6, vce(cluster country_id)
estimate store v3

estout n1 v1 n2 v2 n3 v3, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 



****** Tab A.19*
logit F.alldir camp v2x_polyarchy polyarchy_sq e_migdppcln pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F.alldir camp v2x_polyarchy polyarchy_sq e_migdppcln pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq e_migdppcln pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress F.alldir camp v2x_polyarchy polyarchy_sq e_migdppcln pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F.alldir camp duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F.alldir camp v2x_polyarchy polyarchy_sq e_migdppcln pop e_migdpgro v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 

***** Tab A.20*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F.alldir revcamp2 v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b1
logit F.dircoup revcamp2 v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b2
logit F.dirdem revcamp2 v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b3
logit F.alldir rev_nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b4
logit F.dircoup rev_nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b5
logit F.dirdem rev_nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b6
logit F.alldir revcamp_fail v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b7
logit F.dircoup revcamp_fail v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b8
logit F.dirdem revcamp_fail v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if _est_m1 == 1, vce(cluster country_id)
estimates store b9

estout b1 b4 b7 b2 b5 b8 b3 b6 b9, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 

****** Tab A.21*
logit alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit alldir camp duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


****** Tab A.22
logit F3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress F3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F3.alldir camp duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F3.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


****** Tab A.23*
logit F5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m2
xi: regress F5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
xi: regress F5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop v2svindep duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m4
logit F5.alldir camp duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F5.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m6

estout m1 m2 m3 m4 m5 m6, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 



****** Tab A.24*
*nonviol

logit F.alldir nonviol duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store e2
logit F.dirdem nonviol duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store e4
logit F.dircoup nonviol duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store e6
logit F.alldir viol duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store e3
logit F.dirdem viol duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store e5
logit F.dircoup viol duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store e7

estout e2 e3 e4 e5 e6 e7, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 

 
****** Tab A.25*
logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store e2
logit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store e4
logit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store e6
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store e3
logit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store e5
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store e7

estout e2 e3 e4 e5 e6 e7, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 


***** Tab A.26*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size election v2xps_party duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store m1
logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election v2xps_party duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m2
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election v2xps_party duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
logit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election v2xps_party duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m4
logit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election v2xps_party duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election v2xps_party  duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m6
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m7
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election v2xps_party duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m8
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop v2svindep election duration duration2 duration3 i.country_id i.year if _est_m9==1, vce(cluster country_id)
estimates store m9
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop GDPgrowth v2clrspct e_miurbani resdep2 camp_size e_pt_coup duration duration2 duration3 i.country_id i.year if v2svindep==1, vce(cluster country_id)
estimates store pt1


estout m1 m2 m3 m4 m5 m6 m7 m8 m9 pt1, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 

***** Tab A.27*
logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop  regionbreaks63 nigos civhist warhist duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m1
logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop regionbreaks63 nigos civhist warhist  duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m2
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop regionbreaks63 nigos civhist warhist  duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m3
logit F.dirdem nonviol v2x_polyarchy polyarchy_sq gdppc pop regionbreaks63 nigos civhist warhist  duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m4
logit F.dirdem viol v2x_polyarchy polyarchy_sq gdppc pop regionbreaks63 nigos civhist warhist duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m5
logit F.dircoup nonviol v2x_polyarchy polyarchy_sq gdppc pop regionbreaks63 nigos civhist warhist  duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m6
logit F.dircoup viol v2x_polyarchy polyarchy_sq gdppc pop regionbreaks63 nigos civhist warhist duration duration2 duration3 i.country_id i.year, vce(cluster country_id)
estimates store m7

estout m1 m2 m3 m4 m5 m6 m7, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*country_id* *year*) 

***** Tab A.28*
use "regyear.dta", clear
drop if regime_id == .
xtset regime_id year

logit F.alldir camp v2x_polyarchy polyarchy_sq gdppc pop i.regime_id
estimates store k1
logit F.alldir viol v2x_polyarchy polyarchy_sq gdppc pop i.regime_id
estimates store k2
logit F.alldir nonviol v2x_polyarchy polyarchy_sq gdppc pop i.regime_id
estimates store k3

estout k1 k2 k3, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) drop (*regime_id*) 


****** Tab A.29*
use "data_jcr.dta", clear
xtset country_id year 

xtmlogit mdir L.camp, base(0)
estimates store m0
xtmlogit mdir L.camp L.v2x_polyarchy L.polyarchy_sq L.gdppc L.pop L.v2svindep, base(0) 
estimates store m1
xtmlogit mdir L.camp L.v2x_polyarchy L.polyarchy_sq L.gdppc L.pop L.GDPgrowth L.v2clrspct L.e_miurbani L.resdep2 L.camp_size if v2svindep == 1, base(0)
estimates store m5
xtmlogit mdir L.viol L.v2x_polyarchy L.polyarchy_sq L.gdppc L.pop, base(0)
estimates store m6
xtmlogit mdir L.nonviol L.v2x_polyarchy L.polyarchy_sq L.gdppc L.pop, base(0)
estimates store m7
	
estout m0 m1 m5 m6 m7, cells(b(star fmt(%9.3f)) t(par fmt(%9.2f))) label starlevels (* 0.05 ** 0.01 *** 0.001) stats (N ll r2)style (tex) 





